		<?php $this->load->view('layout/lib_chart');?>
		
		
		<?php 
			$maxheight=$row["sum_assured_death"];
			if ($row["sum_assured_disability"] > $maxheight)$maxheight = $row["sum_assured_disability"];
			if ($row["sum_assured_critical_illness"] > $maxheight)$maxheight = $row["sum_assured_critical_illness"];
			$pit=$row["policy_incepted"]+$row["policy_term"];
			$policy_incepted	=	$row["policy_incepted"];
			$maxheight+=($maxheight*0.1);
			$current_year	=	date('Y');
			$sad	=	round($row['sum_assured_death']-($row['sum_assured_death']/$row['policy_term']));
			$sadi	=	round($row['sum_assured_disability']-($row['sum_assured_disability']/$row['policy_term']));
			$tmp_saci	=	($row['sum_assured_critical_illness']/$row["policy_term"]);
			$saci	=	$row['sum_assured_critical_illness'] - $tmp_saci;
			$saci	=	round($saci);
		?>
		<!-- 2. Add the JavaScript to initialize the chart on document ready -->
		<script type="text/javascript">

			var chart1,chart2,chart3,chart4;
			$(document).ready(function() {
				chart1 = new Highcharts.Chart({
					chart: {
						renderTo: 'container1',
						defaultSeriesType: 'spline',
						inverted: true,
						width: 400,
						style: {
							//margin: '0 auto'
						}
					},
					title: {
						text: 'Protection'
					},
					subtitle: {
						//text: 'According to the Standard Atmosphere Model'
					},
					xAxis: {
						reversed: false,
						title: {
							enabled: true,
							text: 'SAD'
						},
						labels: {
							formatter: function() {
								return this.value +'';
							}
						},
						maxPadding: 0.05,
						//showLastLabel: true,
						min : 0,
						max : <?php echo $maxheight;?>
					},
					yAxis: {
						title: {
							text: 'PI + t'
						},
						labels: {
							formatter: function() {
								return this.value + '';
							}
						},
						lineWidth: 2,
						min : <?php echo $current_year;?>
					},
					legend: {
						enabled: false
					},
					tooltip: {
						formatter: function() {
							return ''+
								this.y +' / '+ this.x +'';
						}
					},
					plotOptions: {
						spline: {
							marker: {
								enable: false
							}
						}
					},
					series: [{
						name: 'Temperature',
						data: [[<?php echo $sad;?>, <?php echo $current_year;?>], [<?php echo ($row["decreasing"] == 0 ? $sad : 0);?>, <?php echo $pit;?>]]
					}]
				});

				chart2 = new Highcharts.Chart({
					chart: {
						renderTo: 'container2',
						defaultSeriesType: 'spline',
						inverted: true,
						width: 400,
						style: {
							//margin: '0 auto'
						}
					},
					title: {
						text: 'Protection'
					},
					subtitle: {
						//text: 'According to the Standard Atmosphere Model'
					},
					xAxis: {
						reversed: false,
						title: {
							enabled: true,
							text: 'SADI'
						},
						labels: {
							formatter: function() {
								return this.value +'';
							}
						},
						maxPadding: 0.05,
						//showLastLabel: true,
						min : 0,
						max : <?php echo $maxheight;?>
					},
					yAxis: {
						title: {
							text: 'PI + t'
						},
						labels: {
							formatter: function() {
								return this.value + '';
							}
						},
						lineWidth: 2,
						min : <?php echo $current_year;?>
					},
					legend: {
						enabled: false
					},
					tooltip: {
						formatter: function() {
							return ''+
								this.y +' / '+ this.x +'';
						}
					},
					plotOptions: {
						spline: {
							marker: {
								enable: false
							}
						}
					},
					series: [{
						name: 'Temperature',
						data: [[<?php echo $sadi;?>, <?php echo $current_year;?>], [<?php echo ($row["decreasing"] == 0 ? $sadi : 0);?>, <?php echo $pit;?>]]
					}]
				});

				chart3 = new Highcharts.Chart({
					chart: {
						renderTo: 'container3',
						defaultSeriesType: 'spline',
						inverted: true,
						width: 400,
						style: {
							//margin: '0 auto'
						}
					},
					title: {
						text: 'Protection'
					},
					subtitle: {
						//text: 'According to the Standard Atmosphere Model'
					},
					xAxis: {
						reversed: false,
						title: {
							enabled: true,
							text: 'SACI',
							align: 'high'
						},
						labels: {
							formatter: function() {
								return this.value +'';
							}
						},
						maxPadding: 0.05,
						//showLastLabel: true,
						min : 0,
						max : <?php echo $maxheight;?>
					},
					yAxis: {
						title: {
							text: 'PI + t',
							align: 'high'
						},
						labels: {
							formatter: function() {
								return this.value + '';
							}
						},
						lineWidth: 2,
						min : <?php echo $current_year;?>
					},
					legend: {
						enabled: false
					},
					tooltip: {
						formatter: function() {
							return ''+
								this.y +' / '+ this.x +'';
						}
					},
					plotOptions: {
						spline: {
							marker: {
								enable: false
							}
						}
					},
					series: [{
						name: 'Temperature',
						data: [[<?php echo $saci;?>, <?php echo $current_year;?>], [<?php echo ($row["decreasing"] == 0 ? $saci: 0);?>, <?php echo $pit;?>]]
					}]
				});

				
				
			});
				
		</script>
		<!-- 3. Add the container -->
		<div>Existing coverage <?php echo $param?></div>
		<table>
			<tr>
				<td><div id="container1" style="width: 400px; height: 400px; margin: 0 auto"></div></td>
				<td><div id="container2" style="width: 400px; height: 400px; margin: 0 auto"></div></td>
				
			</tr>
			<tr>
				<td colspan="2"><div id="container3" style="width: 400px; height: 400px; margin: 0 auto"></div></td>
			</tr>
		</table>
		